import request from '@/utils/request'
import jsonBigInt from 'json-bigint';
const jsonBitIntStr = jsonBigInt({storeAsString: true})
// 获取厂站列表带分页
export function page(query) {
  return request({
    url: '/v1/GET/waga/definition/page',
    method: 'get',
    params: query,
    transformResponse: [function (data) {
      // return jsonBigInt.parse(data)
      return jsonBitIntStr.parse(data)
    }]
  })
}

// 获取厂站列表，不带分页
export function getAllWagaDefinition(query) {
  return request({
    url: '/v1/GET/waga/definition/list',
    method: 'get',
    params: query
  })
}

// 获取厂站单条信息
export function getWagaDefinitionDetail(id) {
  return request({
    url: '/v1/GET/waga/definition/' + id,
    method: 'get',
    transformResponse: [function (data) {
      return jsonBigInt.parse(data)
    }]
  })
}

// 新增厂站信息
export function insertWagaDefinition(data) {
  return request({
    url: '/v1/POST/waga/definition',
    method: 'post',
    data: data
  })
}

// 修改厂站信息
export function updateWagaDefinition(data) {
  return request({
    url: '/v1/PUT/waga/definition',
    method: 'put',
    data: data
  })
}
// 初始化配置数据到缓存
export function initCache() {
  return request({
    url: '/v1/POST/waga/definition/cache',
    method: 'POST',
  })
}
// 删除单个或多个厂站信息
export function delWagaDefinition(ids) {
  return request({
    url: '/v1/DELETE/waga/definition/' + ids,
    method: 'delete'
  })
}

